package com.byapp.fast.common.utils;

import java.util.Map;
import java.util.Set;

public class CheckUtils {

    /* Map校验 */

    /**
     * 校验参数是否存在NULL
     */
    public static boolean isAnyEmpty(Map<String, Object> map) {
        Set<Map.Entry<String, Object>> entries = map.entrySet();
        for (Map.Entry<String, Object> entry : entries) {
            if (entry.getValue() == null) {
                return true;
            }
        }
        return false;
    }

    /**
     * 校验是否包含一个key数组
     */
    public static boolean isALLContains(Map<String, Object> map, String[] keys) {
        for (String key : keys) {
            if (!map.containsKey(key)) {
                return false;
            }
        }
        return true;
    }


    /**
     * 校验参数是否都不为NULL
     */
    public static boolean isNoneEmpty(Map<String, Object> map) {
        return !isAnyEmpty(map);
    }


}
